home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
graphics
/
3dvect30.arj
/
TGA2ICON.ARJ
/
TGA2ICON.DOC
< prev
next >
Wrap
Text File
|
1993-08-10
|
4KB
|
87 lines
This will be reaaall short:
The purpose if TGA2ICON is to take a 24 bit targa file and convert is to
an assembley file with the x and y size of the targa file at the top
two words of the assembley file. This can then be used for the routines in
3dvect20.zip
Lets say you've raytraced a really neet object and want to convert it to an
icon for use in animation/graphics program. This will allow you to seperate
the colour palette, sort it, and generate a x and y icon with indexers to
that palette, in assembler form.
FAQ (frequently asked questions, for those who don't know what FAQ is!)
Q - Why did you write a utility in protected mode!?!
A - It was easy. Re-write it if you like your computer bogged down
with memory managers. The new pmode code allows emm386 to run with this
Q - God that code is sloppy! I could write better in my sleep!
A - So could I. In fact, I think I did write it in my sleep. The code
is sloppy but it works and who cares! (I'm actually quite embarrased
about the poor code quality and considered not releasing the file!)
Q - Why decode a TGA file, why not a GIF?
A - I didn't want to think. (Typical brain dead programmer). TGA is easy
to work with and I didn't want to import code to decode gif for just
a simple utility.
Command line options:
tga2icon filename [/a#]
eg tga2icon picture.tga
tga2icon newmouse.tga /a48
The program will scan the TGA to find how many colours there are in it.
It will then sort the colours according to the RGB values. The output
will begin with those colours in a palette style of table followed by their
sorted equivalent indexers. This way, you have access to the bitmap and the
palette seperatly.
This is where the /a (add) option comes in. If you want this icon to have
it's palette starting at, lets say, colour 32, simply use /a32 option and
all indexers to the palette will start at colour 32. The darkest colour will
be colour 32 and the lightest will be 32+howevermanycolours.
The output file is always called ????????.inc
There are a maximum of 256 colours extraced from the TGA file.
The batches:
I have included some batch files to show you what I use to convert tgas to
icons. I have Image Alchemy and this is what the batch files need to run.
Change the batches to whatever convert program you use.
To convert a 24 bit targa to a 16 colour icon, use alc1.bat It will convert
the file to a 17 colour gif (zero is not considered a colour in the icon)
then convert that back to the original 24 bit TGA. The batch will call
TGA2ICON and convert that new 16 colour tga into an assembley file with
a sorted palette and indexers to that palette. Alc2.bat uses the same
techneque but uses 32 colours instead. To recap, thats TGA to GIF, then
back to original TGA, then to assembler .inc file.
Alcgif.bat will convert a gif to a tga the to an assembler .inc file.
Use alc1 or alc2 if you have a raytraced TGA and Alcgif if you are
converting a handdrawn GIF to an icon.
If you don't like the program, delete it. Like I said, it was for my
personal use only! If you like it/use it but want more features, I can be
reached at:
John McCarthy
1316 Redwood Lane
Pickering, Ontario
L1X 1C5
BTW: John McCarthy thanks TRAN for providing the protected mode header